package com.probox.common.core.utils.money;

import java.text.DecimalFormat;

public class PriceFormatUtil {

    public static String format(Long money){
        if (money == null) money = 0L;
        DecimalFormat decimalFormat = new DecimalFormat("##0.0#");
        return decimalFormat.format(money/100.00);
    }
    public static String format(Double money){
        if (money == null) money = 0.0;
        DecimalFormat decimalFormat = new DecimalFormat("##0.0#");
        return decimalFormat.format(money/100.00);
    }

    public static String format(Integer money){
        if (money == null) money = 0;
        DecimalFormat decimalFormat = new DecimalFormat("##0.0#");
        return decimalFormat.format(money/100.00);
    }

    public static String formatDiscount(Long money){
        if (money == null) money = 0L;
        DecimalFormat decimalFormat = new DecimalFormat("##0.0#");
        return decimalFormat.format(money/10.00);
    }

    public static void main(String[] args) {

    	System.out.println(format(10));
    	System.out.println(format(100));
    	System.out.println(format(1001));
    	System.out.println(format(1011));
    }
}
